package com.oceansoft.mobile.econsole.modules.member.controller;

import com.oceansoft.mobile.econsole.modules.base.controller.BaseController;
import com.oceansoft.mobile.econsole.modules.base.entity.Result;
import com.oceansoft.mobile.econsole.modules.member.service.IUserCacheService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

import static org.springframework.web.bind.annotation.RequestMethod.GET;

/**
 * 登录加速控制器
 *
 * @author andy
 * @time 15-1-21 下午4:10
 */

@RestController
@RequestMapping("api/accelerator")
public class UserLoginAccelerator extends BaseController {

    @Resource
    private IUserCacheService userCacheService;

    @RequestMapping(value = "init", method = GET)
    public Result acceleratorUserByRange(
            @RequestParam(value = "st", required = true) String regStartTime,
            @RequestParam(value = "ed", required = true) String regEndTime
    ) {
        return userCacheService.cacheUserToRedisByRange(regStartTime, regEndTime);
    }

}
